home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 590 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. From: clamage@Eng.Sun.COM (Steve Clamage)
  2. Message-ID: <4h2abb$l69@engnews1.Eng.Sun.COM>
  3. X-Original-Date: 28 Feb 1996 19:27:39 GMT
  4. Path: in2.uu.net!bounce-back
  5. Date: 29 Feb 96 06:18:35 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Return-Path: <daemon@meeker.UCAR.EDU>
  8. Newsgroups: comp.std.c++
  9. Subject: Re: An Extra Virtual Destructor Question t
  10. Organization: Sun Microsystems Inc.
  11. References: <4h25rb$43e@news.xs4all.nl>
  12. Reply-To: clamage@Eng.Sun.COM
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBFAgUBMTVFWOEDnX0m9pzZAQG9kQF+NI3B7ynBoragrR571XBshEPXD8rJw7Wh
  15.     HnMa3m5dbXkcarC17NbzkaXZyfVKLcO0
  16.     =YXRa
  17.  
  18. In article 43e@news.xs4all.nl, veldhuis@xs4all.nl (Wim Veldhuis) writes:
  19. >In message <47voa1$969@gabi.gabi-soft.fr> - kanze@gabi-soft.fr (J. Kanze) 
  20. >writes:
  21. >:>
  22. >:>john (j.d.) hickin (hickin@bnr.ca) wrote:
  23. >:>
  24. >:>|>     class X { public: X(); virtual ~X() = 0; };
  25. >:>
  26. >:>|> Has this been considered?
  27. >:>
  28. >:>In what way?  This has always been legal, and I see nothing in the
  29. >:>present draft to change it.  I occasionally use the idiom to force a
  30. >:>class to be abstract even when I want to provide default behavior for
  31. >:>all of the member functions.
  32.  
  33. >... What you are saying here is that there is somewhere in the draft 
  34. >a rule which states that if a dtor is declared pure virtual, a default 
  35. >implementation (or none at all) is automatically created. Is this the case ?
  36.  
  37. No, and I don't think he was implying that it was the case.
  38.  
  39. You are always allowed to provide an implementation of a pure virtual
  40. function. That function will never be called via the virtual function
  41. call mechanism, however. If you do call a pure virtual function
  42. explicitly, it must be implemented.
  43.  
  44. The compiler will generate calls to the pure virtual destructor if
  45. any derived type is destroyed (you can't create objects of type X).
  46. If you declare a member function, the compiler does not generate it
  47. for you. Thus, if you declare a pure virtual destructor, you usually
  48. must implement it as well. 
  49. ---
  50. Steve Clamage, stephen.clamage@eng.sun.com
  51. ---
  52. [ To submit articles: try just posting with your news-reader.
  53.                       If that fails, use mailto:std-c++@ncar.ucar.edu
  54.   FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  55.   Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  56.   Comments? mailto:std-c++-request@ncar.ucar.edu.
  57. ]
  58.